<!DOCTYPE html>
<html lang="zh-cmn-Hans" xmlns:th="http://www.thymeleaf.org" th:with="title='新办纳税人户数'">
<head th:replace="common/head_query :: common_header_query(~{::link},~{::script})">
    <script type="text/javascript"
            th:src="@{${#servletContext.getAttribute('web.static.url')}+'/echarts2/dist/echarts.js'}"></script>
</head>
<body style="overflow: hidden;">

<div style="height: 500px;width: 100%;" id="queryChars">

</div>

<input th:id="xAxis" th:value="${DQ_MC}" type="hidden"/>
<input th:id="qyHsList" th:value="${QY_HS}" type="hidden"/>
<input th:id="gthList" th:value="${GTH_HS}" type="hidden"/>
<input th:id="fqyDwList" th:value="${FQYDW_HS}" type="hidden"/>
<input th:id="sfJgjcDm" th:value="${sfJgjcDm}" type="hidden"/>

</body>
<script type="text/javascript">
    $("#queryChars").height($(window).height());
    $(function () {
        require.config({
            paths: {
                echarts: echarts2_dist_url
            }
        });
        require(
            [
                'echarts',
                'echarts/chart/line',
                'echarts/chart/bar'
            ],
            function (ec) {
                var myChart = ec.init(document.getElementById('queryChars'));
                window.onresize = function () {
                    if (myChart) {
                        myChart.resize();
                    }
                };


                if($("#sfJgjcDm").val()=="32"||$("#sfJgjcDm").val()=="12"){
                    var option = {
                        tooltip : {
                            trigger: 'axis'
                        },
                        legend: {
                            data: ['企业户数', '个体户数', '非企业单位户数']
                        },
                        calculable : true,
                        xAxis : [
                            {
                                type : 'value',
                                boundaryGap : [0, 0.01]
                            }
                        ],
                        yAxis : [
                            {
                                type : 'category',
                                data : $.parseJSON($('#xAxis').val())
                            }
                        ],
                        series: [
                            {
                                name: '企业户数',
                                type: 'bar',
                                barMaxWidth : 30,
                                data: $.parseJSON($('#qyHsList').val())
                            },
                            {
                                name: '个体户数',
                                type: 'bar',
                                barMaxWidth : 30,
                                data: $.parseJSON($('#gthList').val())
                            },
                            {
                                name: '非企业单位户数',
                                type: 'bar',
                                barMaxWidth : 30,
                                data: $.parseJSON($('#fqyDwList').val())
                            }
                        ]
                    };

                    myChart.setOption(option);
                }else{
                     var option =
                        {
                            tooltip: {'trigger': 'axis'},
                            legend: {
                                x: 'left',
                                data: ['企业户数', '个体户数', '非企业单位户数']
                            },
                            toolbox: {
                                'show': false
                            },
                            calculable: true,
                            xAxis: [{
                                type: 'category',
                                data: $.parseJSON($('#xAxis').val())
                            }],
                            yAxis: [
                                {
                                    type: 'value',
                                    name: '户数'
                                }
                            ],
                            series: [
                                {
                                    name: '企业户数',
                                    type: 'bar',
                                    barMaxWidth : 30,
                                    data: $.parseJSON($('#qyHsList').val())
                                },
                                {
                                    name: '非企业单位户数',
                                    type: 'bar',
                                    barMaxWidth : 30,
                                    data: $.parseJSON($('#gthList').val())
                                },
                                {
                                    name: '企业户数',
                                    type: 'bar',
                                    barMaxWidth : 30,
                                    data: $.parseJSON($('#fqyDwList').val())
                                }
                            ]

                        };
                    myChart.setOption(option);
                }
            }
        );
    });
</script>
</html>